<template>
  <div id="app">
    <!-- 导航栏1 -->
   <nav class="nav" v-if="$route.meta.showMainNav">
     <div class="div"> </div>
      <div class="navbar-title">猫眼电影</div>
      <div class="nav-btn">
        <img src="./assets/更多.png" alt="">
      </div>
    </nav>
    <!-- 猫眼 -->
    <div class="center" v-if="$route.meta.showMainNav">
  
        <img class="logo_custom"
        src="./assets/logo.png" alt="">
   
      <span class="logo_right">发现最新最热电影</span>
    </div>
     <router-view />
     <div class="home-blank"></div>
    <nav class="main-nav"
    
     v-if="$route.meta.showMainNav">

   

     <van-tabbar
      v-model="active"
      active-color="#f0453f"
      inactive-color="#696969"
    >
      <van-tabbar-item
        v-for="item in tabBarArr"
        :key="item.index"
        :to="{ path: item.path }"
      >
        <span>{{ item.title }}</span>
        <template #icon="props">
          <img :src="props.active ? item.icon.active : item.icon.inactive" />
        </template>
      </van-tabbar-item>
    </van-tabbar>
    
    </nav>
    <!-- tab栏主路由的视图出口 -->
   
  </div>
</template>

<script>
// import { Toast } from "vant";
export default {
  data() {
    return {
      date: "",
      show: false,
       active: 0,
      tabBarArr: [
        {
          index: 0,
          title: "电影/影院",
          icon: {
            active: require("./assets/images/movie_.png"),
            inactive: require("./assets/images/movie.png"),
          },
          path: "/movie",
        },
        {
          index: 1,
          title: "视频",
          icon: {
            active: require("./assets/images/video_.png"),
            inactive: require("./assets/images/video.png"),
          },
          path: "/video",
        },
        {
          index: 2,
          title: "小视频",
          icon: {
            active: require("./assets/images/sVideo_.png"),
            inactive: require("./assets/images/sVideo.png"),
          },
          path: "/feed",
        },
      
        {
          index: 3,
          title: "我的",
          icon: {
            active: require("./assets/images/user_.png"),
            inactive: require("./assets/images/user.png"),
          },
          path: "/me",
        },
      ],
    };
  },
  methods: {
    formatDate(date) {
      return `${date.getMonth() + 1}/${date.getDate()}`;
    },
    onConfirm(date) {
      this.show = false;
      this.date = this.formatDate(date);
    },
  },
};
</script>

<style lang="less" >
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  // text-align: center;
  color: #2c3e50;
  .nav{
   display: flex;
    justify-content: space-around;
    width: 100%;
    height: 50px;
    background: #e54847;
    text-align: center;
    position: fixed;
    top: 0;
    z-index: 100;
    
    .div{
      
      width: 30%;
    background-size: 37%;
    }
    .navbar-title{
      width: 30%;
     color: #fff;
    font-size: 20px;
    text-align: center;
    // line-height: 2;
      // text-align: center;
      //  align-items: center;
      margin-top: 11px;
    }
    .nav-btn{
      width: 30%;
      align-items: center;
      img{
        margin-right: -56px;
    margin-top: 16px;
        width: 17px;
        height: 16px;
      }
    }
  }
  .center{
    position: relative;
    height: 60px;
    width: 100%;
    background-color: #fff;
    // z-index: 11;
    display: flex;

    align-items: center;
    box-sizing: border-box;
    left: 0;
    top: 0;
    top: constant(safe-area-inset-top);
    top: env(safe-area-inset-top);
    border-bottom: 1px solid #e8e8e8;
    border-top: 1px solid #e8e8e8;
    position:fixed;
    top:50px;
    z-index: 100;

.logo_custom{
position: absolute;
    left: 1.2rem;
    top: 0.4rem;
    width: 6.88rem;
    height: 2.78rem;
 }
 .logo_right{
   display: inline-block;
    position: absolute;
    height: 0.34rem;
    line-height: .34rem;
    right: 2rem;
    font-size: .26rem;
    font-family: PingFangSC-Regular,Arial,Helvetica,sans-seri;
    font-weight: 620;
    color: #666;
    text-decoration: none;
 }
  }
}

.main-nav {
  z-index: 20;
   text-align: center;
  position: fixed;
  bottom: 0;
  left: 0;
  background: white;
  width: 100%;

  a {
    font-weight: bold;
    color: #666;
    padding: 10px;

    &.router-link-active {
      color: #0e0d0d;
    }
  }
}
.home-blank{
  width: 100%;
  height: 40px;
}
</style>

